/*
** check_team_graph.c for  in /home/renard/Dropbox/epitech/dev/projets/systemunix/zappy/zappy-2015-2014s-renard_g/serv-src
**
** Made by guillaume renard
** Login   <renard_g@epitech.net>
**
** Started on  Sun Jul 15 14:49:39 2012 guillaume renard
** Last update Thu Jul 19 17:26:35 2012 pierrick druart
*/

#include	<stdlib.h>

#include	"server.h"

void		check_team_graph(t_game *game, t_client *client)
{
  game->graphic = client;
  game->event_mnt->add_back(game->event_mnt, new_event(CONNECT_MNT, 0, NULL));
}

void		check_team_egg_slot(t_client *client, t_team *team,
    t_game *game)
{
  t_egg		*egg;

  egg = (t_egg *)team->egg->head->content;
  client->gamer = new_gamer_init(team, egg->coord);
  game->obj[client->gamer->coord.y][client->gamer->coord.x].inv[JOUEUR]++;
  team->nb_player++;
  check_team_concat(client, team, game);
  if (client->sock > (int)game->maxfd)
    game->maxfd = client->sock;
  team->egg->pop(team->egg, &free);
}

void		check_team_slot(t_client *client, t_team *team, t_game *game)
{
  client->gamer = new_gamer(team, game->coord.x, game->coord.y);
  game->obj[client->gamer->coord.y][client->gamer->coord.x].inv[JOUEUR]++;
  team->slot--;
  team->nb_player++;
  check_team_concat(client, team, game);
  if (client->sock > (int)game->maxfd)
    game->maxfd = client->sock;
  serv_monitor("pnw", client, game, game->graphic);
}
